home *** CD-ROM | disk | FTP | other *** search
- Path: inforamp.net!ts44-07
- From: rmorin@inforamp.net (Randy Charles Morin)
- Newsgroups: comp.lang.c++
- Subject: Re: C++ help--probably a simple answer (short listing attached)
- Date: Fri, 02 Feb 96 19:19:11 GMT
- Organization: MiddleWorld SoftWare
- Message-ID: <4etnpg$7s1@sam.inforamp.net>
- References: <4ehdkl$mj0@ixnews7.ix.netcom.com>
- NNTP-Posting-Host: ts44-07.tor.inforamp.net
- X-Newsreader: News Xpress Version 1.0 Beta #4
-
- In article <4ehdkl$mj0@ixnews7.ix.netcom.com>,
- mearrin@ix.netcom.com(Michael Arrington ) wrote:
- >Hi,
- >
- >I have a question about C++. I'm just learning C++ but I've been
- >writing programs in other languages for a number of years. In this
- >problem, I'm creating a class to represent a 2D cellular automaton
- >(like Conway's Life). Here's the (partial) declaration and
- >implementation of the class:
- >
- >class CCellAuto
- >{
- >public:
- > // Public constructors & destructors
- >...
- >...
- >private:
- > // Private data members
- > int xSize; // X dimension of arrays
- > int ySize; // Y dimension of arrays
- > int cell[1][1]; // Array holding live cells
- > int old[1][1]; // Temp array
-
- Odd, why do you do this?
- This 2d arrays have only one cell.
- If you referenced any cell other than cell[0][0] and old[0][0]
- then you would corrupt the data section of your class.
-
- >...
- >...
- >
-
- Agrivar
-